﻿using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using YFurion.Entities;

namespace UpperComputer.Core.Entities
{
    public class BaseRolePermission : CEntity, IEntityTypeBuilder<BaseRolePermission>
    {
        public string RoleCode { get; set; }

        public string PermissionCode { get; set; }

        public int Type { get; set; }

        public int Sort { get; set; }

        public void Configure(EntityTypeBuilder<BaseRolePermission> entity, DbContext dbContext, Type dbContextLocator)
        {
            entity.Property(e => e.Id)
                .ValueGeneratedNever()
                .HasComment("编号");

            entity.Property(e => e.CreationTime).HasComment("操作时间");

            entity.Property(e => e.CreatorUserId)
                .HasComment("操作者编号");

            entity.Property(e => e.PermissionCode)
                .IsRequired()
                .HasMaxLength(100)
                .IsUnicode(false)
                .HasComment("权限编码");

            entity.Property(e => e.RoleCode)
                .IsRequired()
                .HasMaxLength(50)
                .IsUnicode(false)
                .HasComment("角色编码");

            entity.Property(e => e.Sort).HasComment("排序");

            entity.Property(e => e.Type).HasComment("类型");
        }
    }
}